#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include "QList"
#include "api.h"
#include "dishrecommend.h"
#include "mylistwidget.h"
#include "dishitem.h"
#include "sql.h"
#include "optionadd.h"
#include "fridge.h"
#include <QProcess>
#include "optionunit.h"
#include "storageitem.h"
#include "dishrecommendunit.h"
#include "reminditem.h"
namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

private:
    Ui::Widget *ui;
    void initView();
    void initTime();
    void initStorage();
    void initRemind();
    void initDish();
    void initOption();
    QString token = NULL;
    int uid;
    int bind_id;
    Api* api = new Api();
    SQL* sql = new SQL();
    QProcess p;
    QList<long> optionCommit;
    QList<long> optionDelete;


    int dishPageSize = 10;
    int dishPageIndex = 1;
    QString dishName = "";
    QList<OptionUnit*> uncommitList;
    QList<OptionUnit*> commitList;
    QList<DishItem*> dishSearchList;
    QList<StorageItem*> StorageList;
    QList<DishRecommendUnit*> dishRecommendUnitList;
    QList<RemindItem*> remindItemList;
public slots:
    void showtime();
    void updateUserInfo(int uid,QString username,QString phone,QString email,QString avator,int gender);
    void updateDishRecommend(QList<DishRecommend>* list);
    void updateDishSearch(QList<Dish>* dishList);
    void updateStorage();
    void updateRemind();
    void updateOptionUncommit();
    void updateOptioncommit();
    void updateFridgeInfo(Fridge fridge);
    void startRec();
    void endRec();
    void parseRec();

signals:
    void updateOptionUnCommitSignal();

};

#endif // WIDGET_H
